package com.sophialex.health.record.common.assist;

import java.util.ArrayList;
import java.util.List;

import org.eclipse.swt.SWT;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.widgets.TableColumn;
import org.eclipse.swt.widgets.Text;

import com.sophialex.health.person.vo.HrPerson;
import com.sophialex.health.record.Messages;
import com.sophialex.health.system.frame.assist.CommonAssist;
import com.sophialex.health.system.frame.dialog.DialogManager;
/**
 * 个人查询悬浮窗
 * <p>Title:Health</p>
 * <p>HrPersonAssist</p>
 * 
 * Alex Apr 18, 2011 2:18:25 PM create
 * @author <a href='wanghao924@126.com'>Alex</a>
 * QQ: 873987060;
 * @version 1.0
 */
public class HrPersonAssist extends CommonAssist {
    private Text text;
	public HrPersonAssist(Text text, String property) {
		super(text, property,2);
		filterPro = new String[] { "name", "sex", "birthday","idno","adminUserId","cadress"};
		try {
			List<HrPerson> listg = new ArrayList<HrPerson>();
			HrPerson person = new HrPerson();
		    person.setName("汪啸虎");
			
			HrPerson person1 = new HrPerson();
		    person1.setName("张小么");
		    
			listg.add(person);
			listg.add(person1);
	
			list = listg;
			this.text = text;
		} catch (Exception e) {
			DialogManager.invokeWarnDlg(e.getLocalizedMessage());
		}
	}

	@Override
	protected void createColumn() {
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(50);
			column.setText(Messages.getString("HrPersonAssist.0")); 
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(50);
			column.setText(Messages.getString("HrPersonAssist.1")); 
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(70);
			column.setText(Messages.getString("HrPersonAssist.2")); 
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(100);
			column.setText(Messages.getString("HrPersonAssist.3")); 
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(50);
			column.setText(Messages.getString("HrPersonAssist.4")); 
		}
		{
			TableColumn column = new TableColumn(table, SWT.NONE);
			column.setWidth(150);
			column.setText(Messages.getString("HrPersonAssist.5")); 
		}
		dbTable.setColumnProperties(filterPro);
		dbTable.exeDbTable(HrPerson.class);

	}
    
	public void updateControl(Object o) {
		if (o != null) {
			HrPerson gys = (HrPerson) o;
			text.setText(gys.getName());
		}
	}
	
	@Override
	public Point getInitialSize() {
		return new Point(700,300);
	}

}
